package com.tomehay.termprojectmanage_server.controller;


import java.util.List;

import com.tomehay.termprojectmanage_server.pojo.Model.GroupMember;
import com.tomehay.termprojectmanage_server.pojo.Model.PersonalTask;
import com.tomehay.termprojectmanage_server.pojo.VO.ResultVO;
import com.tomehay.termprojectmanage_server.service.GroupMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tomehay
 * @since 2023-06-20
 */
@RestController
@RequestMapping("api/group-member")
public class GroupMemberController {

    @Autowired
    private GroupMemberService groupMemberService;

    @PostMapping("/submitUpload")
    public void submitTaskByUpload(@RequestPart("file") MultipartFile file) {
        groupMemberService.submitTaskByUpload(file);
    }

    @PostMapping("/submitChoose")
    public void submitTaskByChoose(@RequestBody List<PersonalTask> personalTask) {
        groupMemberService.submitTaskByChoose(personalTask);
    }


    @GetMapping("/GetGroupMember")
    public ResultVO<GroupMember> getGroupMemberByGroupIdAndStudentId(int groupId,int studentId){
        return groupMemberService.getGroupMemberByGroupIdAndStudentId(groupId,studentId);
    }


}
